package inboundandoutbound;/*

 */

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

/**
 * @ClassName MyClientInitializer
 * @Author Final
 * @Project DataStructures
 */
public class MyClientInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {

        ChannelPipeline pipeline = socketChannel.pipeline();

        //自定义一个出栈的hanndler，对数据进行编码，后执行
        pipeline.addLast(new MyLongToByteEncoder());

        //自定有handler，处理业务，先执行
        pipeline.addLast(new MyClientHandler());
    }
}
